import request from '@/utils/request';

export type addCommentQuery = {
  target: string;
  content: string;
  art_id: string;
};

// 获取评论数据
export const getCommentsAPI = (params: { type: string; source: string }) =>
  request({
    url: '/v1_0/comments',
    params,
  });

// 添加评论
export const addCommentAPI = (data: addCommentQuery) =>
  request({
    url: '/v1_0/comments',
    method: 'POST',
    data,
  });

// 点赞评论
export const isLikingAPI = (target: string) =>
  request({
    url: '/v1_0/comment/likings',
    method: 'POST',
    data: { target },
  });

// 取消点赞评论
export const cancelIsLikingAPI = (target: string) =>
  request({
    url: `/v1_0/comment/likings/${target}`,
    method: 'DELETE',
  });
